
/*
 * =====================================================================================
 *       Filename:  HttpRequest.h
 *
 *    Description:
 *
 *
 *        Version:  1.0
 *        Created:  03/05/19 11:04:08
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  liushuyong (), shuyong1999@163.com
 *        Company:  shuyong
 *
 * =====================================================================================
 */
#ifndef RequestObj_H_
#define RequestObj_H_

#include <iostream>
#include <vector>

#include "CommHead.h"
#include "HttpParam.h"
#include "RequestSession.h"
#include  "RPCContext.h"

using brpc::Controller;
using std::string;
using google::protobuf::Closure;
using brpc::ClosureGuard;
using std::shared_ptr;
using std::atomic;
using std::vector;
using std::endl;
using std::make_shared;
using brpc::SharedObject;

//TODO SharedObject 是做什么用

class RequestObj;
typedef shared_ptr < RequestObj > RequestObjSPtr;   //定义智能指针类型

class RequestObj: public SharedObject {
  public:
    RequestObj();
    ~RequestObj();
    int parseRequest();
    void handleRequest();
    void newContxtInfo(Controller* cntl, Closure* done);

  private:
    int parseProperty(const string* property_value);
    void ackHttpError();

  private:
    RPCContextSPtr mspRPCContext;

    vector < string > mRuleSrcVector;   //SSML Param
    vector < string > mRuleDestVector;
};

#endif
